<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    var a = {n: 1};
    var b = a;
    a = a.x = {n: 2};
    // a.x = a = {n: 2};
    console.log(a.x); // undefined
    console.log(b.x); // {n: 2}
    console.log(a.n); // 2
    console.log(b.n);// 1
</script>
</html>